package com.Team7.controller;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.TextArea;
import javafx.stage.Stage;

import java.io.IOException;

public class DiskSpaceController {

    private Stage stage;
    private MainController mainController;

    @FXML
    private TextArea ta_diskSpace;


    public DiskSpaceController(MainController mainController){
        this.mainController=mainController;
        this.stage=new Stage();
        FXMLLoader fxmlLoader=new FXMLLoader(getClass().getResource("../fxml/DiskSpace.fxml"));
        fxmlLoader.setController(this);
        try {
            stage.setScene(new Scene(fxmlLoader.load(),850,600));
            stage.setTitle("磁盘空间");
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

    public void show(){
        stage.show();
    }

    private void setText(){
        String str=mainController.getDiskSpace();
        //System.out.println(str);
        ta_diskSpace.appendText(str);

        ta_diskSpace.setScrollTop(Double.MAX_VALUE);
    }

    @FXML
    private void  initialize(){
        setText();
    }




}
